<template>
  <div id="" class="indexMenu">
    <router-link :to="{ path: '/houseList', query: {rentType:1,state:1}}">
      <img src="@/assets/images/wholeRent@2x.png" width="48"/>
      <br>
      整租
    </router-link>
    <router-link :to="{ path: 'houseList', query: {rentType:1,state:4}}">
      <img src="@/assets/images/changeRent@2x.png" width="48"/><br>
      转租
    </router-link>
    <router-link :to="{ path: '/shortHouselist', query: {rentType:2}}">
      <img src="@/assets/images/shortRent@2x.png" width="48"/><br>
      短租
    </router-link>
    <a @click="releaseHouse">
      <img src="@/assets/images/publishHouse@2x.png" width="48"/><br>
      发布房源
    </a>
  </div>
</template>
<script>
import { mapState } from 'Vuex';
import { MessageBox,Toast } from 'mint-ui';
import {reLoginWX} from '@/util/util.js';
export default {
  name: "",
  props: ['isRealAuth'],
  data: () => ({

  }),
  computed:{
    ...mapState({
      token:state=>state.login.token,
    })
  },
  methods: {
    releaseHouse() {
      var that = this;
      // let userInfo = window.localStorage.getItem('userInfo');
      // console.log(userInfo);
      var token = window.localStorage.getItem('userToken');   //获取用户token
      let syOpenId = window.localStorage.getItem('syOpenId');     //获取缓存中的openi
      if (syOpenId=='null' || syOpenId==undefined) {  //未授权
        reLoginWX();
      }else if(token=='null'||token==undefined){
        MessageBox.confirm('您还未登录，请先登录?').then(action => {
          that.$router.push({name:'login'});
        }).catch(err=>{
          console.log(err);
        });
      }else{
        if(that.isRealAuth!=1){   //未认证
          Toast('您还未实名认证，请先到个人中心设置去认证一下吧~');
        }else{
          that.$router.push({name:'releaseHouse'});
        }

      }
    }
  }
}
</script>
<style lang="scss" scoped>

.indexMenu{
	background: white;
  @include flex;
  text-align: center;
  padding:10px 0;
  img{
  	margin-bottom: 5px;
  }
  a{
    @include flexcell;
    color:$lightColor;
  }
}
</style>
